<?php
@header('Content-type: text/html;charset=UTF-8');
require_once ('check.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>站点类型编辑</title>
<link rel="stylesheet" href="../images/css.css" type="text/css" />
<script type="text/javascript">
 function check(){
	          var countyTypeName = document.getElementById("countyTypeName");
	          if(trim(countyTypeName.value)==null || trim(countyTypeName.value)==""){
	             alert("请输入类型名称");
	             countyTypeName.focus();
	             return false;
	         }
	         return true;
	     }
	     function trim(str){ //删除左右两端的空格
	     　　     return str.replace(/(^\s*)|(\s*$)/g, "");
	     }
</script>
</head>
<body>
<?php
if ($_POST["Submit"]) {
    $id = $_POST["id"];
    $countyTypeName = str_replace(' ','',$_POST["countyTypeName"]);
    $memo = str_replace(' ','',$_POST["memo"]);
    $sql = "update countytype set countyTypeName='$countyTypeName', memo='$memo' where id=$id";
    mysql_query($sql);
    header("location:index.php?pageno=$pageno");
}
$id = $_GET["id"];
$pageno = $_GET["pageno"];

$sql = "select * from countytype where id=$id";
$rs = mysql_query($sql);
if (mysql_num_rows($rs) != 0) {
    while ($rows = mysql_fetch_assoc($rs)) {
        ?>
		<form id="form1" name="form1" method="post" action=""
		onsubmit="return check();">
		<table width="100%" border="0" align="center" cellpadding="5"
			cellspacing="1" bordercolor="#000000" bgcolor="#cccccc">
			<tr>
				<th colspan="2" bgcolor="#FFFFFF">修改站点类型</th>
			</tr>
			<tr>
				<td bgcolor="#FFFFFF" class="forumRowHighlight">类型编号:</td>
				<td bgcolor="#FFFFFF" class="forumRowHighlight"><span><?php echo $rows["countyTypeId"]?></span></td>
			</tr>
			<tr>
				<td bgcolor="#FFFFFF" class="forumRowHighlight">类型名称:</td>
				<td bgcolor="#FFFFFF" class="forumRowHighlight"><input type="text"
					name="countyTypeName" id="countyTypeName"
					value="<?php echo $rows["countyTypeName"]?>" />*</td>
			</tr>
			<tr>
				<td bgcolor="#FFFFFF" class="forumRowHighlight">类型说明:</td>
				<td bgcolor="#FFFFFF" class="forumRowHighlight"><textarea rows="5"
						cols="15" name="memo"><?php echo $rows["memo"]?></textarea></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="hidden" name="id"
					value="<?php echo $rows["Id"]?>" /> <input name="Submit"
					type="submit" class="button" value="提交" /> &nbsp; <input
					name="reset" type="reset" class="button" value="重置" /></td>
			</tr>
		</table>
	</form>
  <?php
    }
}
?>	
</body>
</html>